home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 002 / chedit.arc / EGA.C < prev    next >
Text File  |  1986-07-23  |  2KB  |  54 lines

  1. /* 
  2.    This program is placed in the public domain by its author, William Couture.
  3.    Copyright (c) 1986 by DDI.   All Rights Reserved.
  4. */
  5.  
  6. void loadega14(shapes1,shapes2,num,offset)
  7.    unsigned char *shapes1,*shapes2;
  8.    int num,offset;
  9.  
  10.   /* WARNING:  This routine is a stack hog!
  11.                Make sure that you have AT LEAST 2K of FREE stack before
  12.                calling this routine, or the system may CRASH!
  13.   */
  14.  
  15.              /* Num is the number of character shapes to load.
  16.                 Size is the size of the character in lines.
  17.                 Offset is the offset into the character shapes to start
  18.                 loading at.  Normally, it is 0 (normal ASCII characters)
  19.                 or 128 (extended ASCII characters).
  20.                 Note, however, that loading the any characters will
  21.                 recalculate the character sizes based on the size of the
  22.                 characters being loaded.  Thus, if you load an 8 x 14 into
  23.                 the upper characters, you will get an 8 x 14 display in
  24.                 the lower 128 characters, even if an 8 x 8 character set
  25.                 is still loaded. */
  26.  
  27.              /* This procedure will combine two CHEDIT character sets into
  28.                 an 8 x 14 character set for use as an EGA resident character
  29.                 set (See the chedit documentation for details on the contents
  30.                 of the character sets). */
  31.    {
  32.    unsigned char newshape[1792];
  33.    int i,j,k,l;
  34.  
  35.    l = 0;
  36.    for (i = 0; i < 65; i += 64)    /* This is kind of like shuffling a deck */
  37.       for (j = 0; j < 32; j++)     /* two rows of 32 characters, which */
  38.          {                         /* start 64 characters apart */
  39.          for (k = 0; k < 8; k++)   /* upper 8 rows of character */
  40.             newshape[l++] = shapes1[(i+j)*8+k];
  41.          for (k = 0; k < 6; k++)   /* lower 6 rows of character */
  42.             newshape[l++] = shapes1[(i+j+32)*8+k];
  43.          }
  44.    for (i = 0; i < 65; i += 64)    /* now do the next set */
  45.       for (j = 0; j < 32; j++)
  46.          {
  47.          for (k = 0; k < 8; k++)
  48.             newshape[l++] = shapes2[(i+j)*8+k];
  49.          for (k = 0; k < 6; k++)
  50.             newshape[l++] = shapes2[(i+j+32)*8+k];
  51.          }
  52.    loadega(newshape,num,14,offset);
  53.    }
  54.